import { ChangeDetectionStrategy, Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core';
import { Node } from '@antv/x6';
import { SHAPE_TYPE } from 'src/app/shared/enum';
import { TextComponent } from './template/text/text.component';

@Component({
  selector: 'wf-node-view-editor',
  templateUrl: './node-view-editor.component.html',
  styleUrls: ['./node-view-editor.component.less'],
  changeDetection: ChangeDetectionStrategy.OnPush
})
export class NodeViewEditorComponent implements OnInit, OnChanges {

  @Input() currentNode: Node<Node.Properties> | undefined;

  shape!: string;
  shapeType = SHAPE_TYPE;

  flag = false;

  constructor() { }

  ngOnChanges(changes: SimpleChanges): void {
    console.log('onchange');

    if (changes['currentNode']) {
      this.shape = this.currentNode?.shape!;
    }

  }

  ngOnInit(): void {
    console.log('onInit');
  }

}
